﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:DShow="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Controls="clr-namespace:SampleApplication.Controls"
        x:Class="SampleApplication.Window3"
        Title="WPF MediaKit DVD Player Sample"
        Height="800"
        Width="800"
        mc:Ignorable="d">
    <Window.Resources>
        <Storyboard x:Key="HideAuxControls">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                           Storyboard.TargetName="canvas"
                                           Storyboard.TargetProperty="(Canvas.Top)">
                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000"
                                      Value="14"
                                      KeySpline="0,0,1,0" />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                           Storyboard.TargetName="canvas"
                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00.4000000"
                                      Value="0" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Key="ShowAuxControls">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                           Storyboard.TargetName="canvas"
                                           Storyboard.TargetProperty="(Canvas.Top)">
                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                      Value="44"
                                      KeySpline="0,1,1,1" />
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                           Storyboard.TargetName="canvas"
                                           Storyboard.TargetProperty="(UIElement.Opacity)">
                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000"
                                      Value="1" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger RoutedEvent="Mouse.MouseEnter"
                      SourceName="viewbox">
            <BeginStoryboard x:Name="ShowAuxControls_BeginStoryboard"
                             Storyboard="{StaticResource ShowAuxControls}" />
        </EventTrigger>
        <EventTrigger RoutedEvent="Mouse.MouseLeave"
                      SourceName="viewbox">
            <BeginStoryboard x:Name="HideAuxControls_BeginStoryboard"
                             Storyboard="{StaticResource HideAuxControls}" />
        </EventTrigger>
    </Window.Triggers>
    <Grid Background="#FF000000">
        <Controls:FolderDialog x:Name="folderDialog"/>
        <StackPanel>
            <Border>
                <Border.Style>
                    <Style TargetType="{x:Type Border}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsOverDvdButton, ElementName=dvdPlayer}"
                                         Value="true">
                                <Setter  Property="Cursor"
                                         Value="Hand" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Border.Style>
                <DShow:DvdPlayerElement x:Name="dvdPlayer"
                                        Volume="1"
                                        PlayOnInsert="true"
                                        LoadedBehavior="Play"
                                        DvdDirectory="{Binding ElementName=folderDialog, Path=FolderPath, Mode=TwoWay}"
                                        MinWidth="640"
                                        MinHeight="480" />
            </Border>
            <StackPanel Margin="0,-84,0,0">
                <Slider x:Name="positionSlider"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Orientation="Horizontal"
                        Width="300"
                        SmallChange="1"
                        LargeChange="1000"
                        Value="{Binding MediaPosition, ElementName=dvdPlayer}"
                        Maximum="{Binding MediaDuration, ElementName=dvdPlayer}"
                        Style="{DynamicResource MediaTimeSliderStyle}" />
                <Viewbox x:Name="viewbox"
                         HorizontalAlignment="Center"
                         Stretch="Uniform"
                         Height="51">
                    <Canvas Width="219"
                            Height="41">
                        <Canvas.Effect>
                            <DropShadowEffect ShadowDepth="4"
                                              BlurRadius="12"
                                              Direction="295" />
                        </Canvas.Effect>
                        <Canvas x:Name="canvas"
                                Width="128"
                                Height="12"
                                Canvas.Left="45.588"
                                Canvas.Top="14"
                                Opacity="0">
                            <Button Content="Play Title"
                                    Canvas.Left="44"
                                    Style="{DynamicResource TextMediaButton}"
                                    Width="40"
                                    Height="12"
                                    Foreground="White"
                                    FontSize="6.667"
                                    HorizontalContentAlignment="Center"
                                    VerticalContentAlignment="Center"
                                    FontWeight="Bold"
                                    Padding="0"
                                    Command="DShow:DvdPlayerElement.PlayTitleCommand"
                                    CommandParameter="1"
                                    CommandTarget="{Binding ElementName=dvdPlayer}" />
                            <Button Content="Root Menu"
                                    Canvas.Left="88"
                                    Style="{DynamicResource TextMediaButton}"
                                    Width="40"
                                    Height="12"
                                    FontSize="6.667"
                                    FontWeight="Bold"
                                    Foreground="White"
                                    HorizontalContentAlignment="Center"
                                    Padding="0"
                                    VerticalContentAlignment="Center"
                                    Command="DShow:DvdPlayerElement.GotoRootMenuCommand"
                                    CommandTarget="{Binding ElementName=dvdPlayer}" />
                            <Button Content="Title Menu"
                                    Style="{DynamicResource TextMediaButton}"
                                    Width="40"
                                    Height="12"
                                    FontSize="6.667"
                                    FontWeight="Bold"
                                    Foreground="White"
                                    HorizontalContentAlignment="Center"
                                    Padding="0"
                                    VerticalContentAlignment="Center"
                                    Command="DShow:DvdPlayerElement.GotoTitleMenuCommand"
                                    CommandTarget="{Binding ElementName=dvdPlayer}" />
                        </Canvas>
                        <Path Stretch="Fill"
                              StrokeLineJoin="Round"
                              StrokeThickness="1.2"
                              Width="218"
                              Height="40.678"
                              Canvas.Top="-1.095"
                              Data="M109.24504,0.5 C114.03861,0.49999881 118.43511,2.2003291 121.86445,5.0306299 L122.51595,5.5949948 205.5,5.5949948 C212.12742,5.5949938 217.5,10.967577 217.5,17.594993 L217.5,22.594993 C217.5,29.222412 212.12742,34.594995 205.5,34.594995 L123.03446,34.594995 122.5843,35.024179 C119.06116,38.226331 114.38101,40.177999 109.24504,40.177999 104.10908,40.177999 99.428704,38.226331 95.905301,35.024179 L95.455114,34.594995 12.5,34.594995 C5.8725815,34.594995 0.5,29.222412 0.5,22.594993 L0.5,17.594993 C0.5,10.967577 5.8725815,5.5949938 12.5,5.5949948 L95.973664,5.5949948 96.6252,5.0306299 C100.05478,2.2003291 104.45148,0.49999881 109.24504,0.5 z"
                              Opacity="1"
                              Stroke="{x:Null}">
                            <Path.Fill>
                                <LinearGradientBrush EndPoint="0.5,1"
                                                     StartPoint="0.5,0"
                                                     MappingMode="RelativeToBoundingBox">
                                    <GradientStop Color="#8A000000"
                                                  Offset="0" />
                                    <GradientStop Color="#8A000000"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Path.Fill>
                        </Path>
                        <Path Stretch="Fill"
                              StrokeLineJoin="Round"
                              StrokeThickness="1.2"
                              Width="218"
                              Height="40.678"
                              Canvas.Top="-1.095"
                              Data="M109.24504,0.5 C114.03861,0.49999881 118.43511,2.2003291 121.86445,5.0306299 L122.51595,5.5949948 205.5,5.5949948 C212.12742,5.5949938 217.5,10.967577 217.5,17.594993 L217.5,22.594993 C217.5,29.222412 212.12742,34.594995 205.5,34.594995 L123.03446,34.594995 122.5843,35.024179 C119.06116,38.226331 114.38101,40.177999 109.24504,40.177999 104.10908,40.177999 99.428704,38.226331 95.905301,35.024179 L95.455114,34.594995 12.5,34.594995 C5.8725815,34.594995 0.5,29.222412 0.5,22.594993 L0.5,17.594993 C0.5,10.967577 5.8725815,5.5949938 12.5,5.5949948 L95.973664,5.5949948 96.6252,5.0306299 C100.05478,2.2003291 104.45148,0.49999881 109.24504,0.5 z"
                              Opacity="1"
                              Fill="{DynamicResource Glassage}">
                            <Path.Stroke>
                                <LinearGradientBrush EndPoint="0.5,1"
                                                     StartPoint="0.5,0">
                                    <GradientStop Color="#FF000000"
                                                  Offset="1" />
                                    <GradientStop Color="#FFC1C1C1"
                                                  Offset="0" />
                                </LinearGradientBrush>
                            </Path.Stroke>
                        </Path>
                        <Canvas HorizontalAlignment="Center"
                                Margin="0,0,0,0"
                                VerticalAlignment="Center"
                                Width="132"
                                Height="40"
                                Canvas.Left="43.833"
                                Canvas.Top="-0.084">
                            <Button Style="{DynamicResource PreviousButton}"
                                    Content="Button"
                                    Canvas.Left="0"
                                    Canvas.Top="8"
                                    Command="DShow:DvdPlayerElement.PreviousChapterCommand"
                                    CommandTarget="{Binding ElementName=dvdPlayer}" />
                            <Button Content="Button"
                                    Style="{DynamicResource NextButtonStyle}"
                                    Canvas.Left="83"
                                    Canvas.Top="8"
                                    Command="DShow:DvdPlayerElement.NextChapterCommand"
                                    CommandTarget="{Binding ElementName=dvdPlayer}" />
                            <ToggleButton Style="{DynamicResource MediaPlayPauseToggleStyle}"
                                          Width="36.626"
                                          Height="38.666"
                                          Content="ToggleButton"
                                          Canvas.Left="46.738"
                                          Canvas.Top="2"
                                          Command="DShow:MediaElementBase.TogglePlayPauseCommand"
                                          CommandTarget="{Binding ElementName=dvdPlayer}"
                                          IsChecked="{Binding IsPlaying, ElementName=dvdPlayer, Mode=OneWay}" />
                        </Canvas>
                        <Slider Canvas.Top="14.842"
                                Canvas.Left="179.833"
                                Width="34.167"
                                Style="{DynamicResource AudioSliderStyle}"
                                Minimum="0"
                                LargeChange="0.1"
                                Maximum="1"
                                Value="{Binding Volume, ElementName=dvdPlayer}" />
                        <Button Content="Open ^"
                        	Canvas.Left="4.833"
                        	Style="{DynamicResource TextMediaButton}"
                        	Width="36"
                        	Height="12"
                        	Foreground="White"
                        	FontSize="6.667"
                        	HorizontalContentAlignment="Center"
                        	VerticalContentAlignment="Center"
                        	FontWeight="Bold"
                        	Padding="0"
                        	Command="Controls:FolderDialog.SelectFolderCommand"
                        	CommandTarget="{Binding ElementName=folderDialog}" Canvas.Top="14" />
                    </Canvas>
                </Viewbox>
            </StackPanel>
        </StackPanel>
        <TextBlock Text="{Binding CurrentDvdTime, ElementName=dvdPlayer}"
                   Foreground="White"
                   VerticalAlignment="Top"
                   FontSize="26.667"
                   FontWeight="Bold">
        	<TextBlock.Effect>
        		<DropShadowEffect ShadowDepth="0" />
        	</TextBlock.Effect></TextBlock>
    </Grid>
</Window>
